// UIMainTabCtrl.cpp : implementation file
//

#include "stdafx.h"
#include "JianAiSSQ.h"
#include "UIMainTabCtrl.h"
#include "UIShaHaoDlg.h"
#include "UIHaoMaDlg.h"
#include "UITeZhengMainDlg.h"
#include "JianAiSSQDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CUIMainTabCtrl

CUIMainTabCtrl::CUIMainTabCtrl()
{
	m_bErr = false;
}

CUIMainTabCtrl::~CUIMainTabCtrl()
{
}


BEGIN_MESSAGE_MAP(CUIMainTabCtrl, CTabCtrlSSL)
	//{{AFX_MSG_MAP(CUIMainTabCtrl)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CUIMainTabCtrl message handlers

void CUIMainTabCtrl::OnActivatePage (int nIndex, int nPageID) {
	// TODO: Override in derived class to respond to page activations.
	if (m_bErr)
	{
		ActivateSSLPage(m_nDelActive);
	}
	else
	{
		ActivateSSLPage(nIndex);

	}

}

void CUIMainTabCtrl::OnDeactivatePage (int nIndex, int nPageID) {
	// TODO: Override in derived class to respond to page deactivations.

	m_nDelActive = nIndex;
	switch (nIndex)
	{
	case	HAOMA_PAGE:
		if (!theApp.GetMainDlg()->m_dlgHaoMa.UpdateHMData())
		{
			m_bErr = true;
		}
		else
			m_bErr = false;
		return;
	case	ZUOBIAO_PAGE:
		if (!theApp.GetMainDlg()->m_dlgZuoBiao.UpdateZuoBiaoData())
		{
			m_bErr = true;
		}
		else
			m_bErr = false;
		return;
	case	K11_PAGE:
		if (!theApp.GetMainDlg()->m_dlgK11.UpdateK11Data())
		{
			m_bErr = true;
		}
		else
			m_bErr = false;
		return;
	case	HL_PAGE:
		if (!theApp.GetMainDlg()->m_dlgHangLie.UpdateHLData())
		{
			m_bErr = true;
		}
		else
			m_bErr = false;
		return;
	case	SHAHAO_PAGE:
		if (!theApp.GetMainDlg()->m_dlgShaHao.UpdateSHData())
		{
			m_bErr = true;
		}
		else
			m_bErr = false;
		return;
	case	TEZHENG_PAGE:
		if (!theApp.GetMainDlg()->m_dlgTeZhengMain.UpdateTZData())
		{
			m_bErr = true;
		}
		else
			m_bErr = false;
		return;
	default:
		m_bErr = false;
		break;	

	}
	
	m_bErr = false;

}

